﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Text;

namespace WFL.Data.SqlClient
{
    public class SqlDataReaderExtension
    {
        public SqlDataReader Reader
        {
            get;
            private set;
        }

        internal SqlConnection Connection
        {
            get;
            set;
        }

        internal SqlTransaction Transaction
        {
            get;
            set;
        }

        internal SqlDataReaderExtension(SqlDataReader reader)
        {
            Reader = reader;
        }

        public void Close()
        {
            Reader.Close();
            if (Transaction != null)
            {
                Transaction.Commit();
            }
            if (Connection != null)
            {
                Connection.Close();
            }
        }
    }
}
